<table class="ctable" id="dsRoom" width="100%">
<?php
session_start();
$user=$_SESSION['username'];
$room_id=$_REQUEST['room_id'];
$room_name=$_REQUEST['room_name'];
$page=$_REQUEST['page'];
$per_page=$_REQUEST['per_page'];
$per_page=5;
include_once '../Model/Room.php';
$room= new Room();
$rs=$room->get_list_room($room_id,$room_name,1,$page,$per_page);
	$file='../../log/debug/'.date("y-m-d").'.txt';
	$f=fopen($file,'a+');
	if($f){
		fwrite($f,"ROOM_GET_LIST_ROOM: ".$user." ".gmdate('Y-m-d H:i:s')."\r");
	}

if($rs!=NULL){
$result='';
$action='';
 for($i=0;$i<count($rs);$i++){
	 	$j=$i+1;
		if($rs[$i][5]==NULL){
			$rs[$i][5]="lib/images/phonghop.jpg";
		}
		$result=$result.'<td width="20%"><div class="subContent">
  		  <a href="javascript:open_room(\''.$rs[$i][0].'\')" ><img src="'.$rs[$i][5].'" style="margin-left: 5%;margin-right: 5%;text-align:center;width:85%;height:120px;"/><br>
		  <font color="#000000">'.$rs[$i][1].'</font></a></div></td>';
		$action=$action.'<td width="20%"><div id="control_'.$j.'" class="viewAction">
			 	  <a href="javascript:open_room(\''.$rs[$i][0].'\')" ><input type="button" class="cbutton" value="見る"></a>
				  <a href="javascript:edit_room(\''.$rs[$i][0].'\')" ><input type="button" class="cbutton" value="編成する"></a>
				  <a href="javascript:delete_room(\''.$rs[$i][0].'\',\''.$rs[$i][1].'\')"><input type="button" class="cbutton" value="削除する"></a>
	    </div></td>';
}
for($i=5;$i>count($rs);$i--){
	$result=$result."<td width='20%'></td>";
}
$result='<tr>'.$result.'</tr>';
$action='<tr>'.$action.'</tr>';
$result=$result.$action;
echo $result;
}
?>
</table>